import { defineStore } from "pinia";

interface AppStoreState {
	userid: string;
	username: string;
}

export const useAppStore = defineStore({
	id: "AppStore",
	state: (): AppStoreState => ({
		userid: "",
		username: ""
	}),
	actions: {
		setUser(id: string, name: string) {
			this.userid = id;
			this.username = name;
		},
		getUserId() {
			return this.userid;
		},
		getUserName() {
			return this.username;
		}
	},
	persist: {
		storage: sessionStorage
	}
});
